package com.example.personnel_management_system.config;

import com.example.personnel_management_system.interceptor.LoginInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.util.ArrayList;
import java.util.List;

@Configuration
public class LoginInterceptorConfig implements WebMvcConfigurer {
    HandlerInterceptor interceptor=new LoginInterceptor();
    List<String>list=new ArrayList<>();
    {
        list.add("/comment/*");
        list.add("/emfh/*");
        list.add("/emset/*");
        list.add("/memoyfh/*");
        list.add("/memoyset/*");
        list.add("/system/*");
    }
    @Override
    public void addInterceptors(InterceptorRegistry registry) {

        registry.addInterceptor(interceptor).addPathPatterns(list);
    }
}
